package com.df.common.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * @author yangjindou
 * @date 2022-03-30
 */
@Getter
@Setter
@Accessors(chain = true)
public class BaseEntity implements Serializable {

    // id字段无法放在baseEntity中，因为自增长注解不能放在父类里

    @Schema(description = "创建日期")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @TableField(fill = FieldFill.INSERT)
    private Date createDate;


    @Schema(description = "创建人")
    @TableField(fill = FieldFill.INSERT)
    private String createUser;

    @Schema(description = "修改日期")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @TableField(fill = FieldFill.UPDATE)
    private Date updateDate;

    @Schema(description = "修改人")
    @TableField(fill = FieldFill.UPDATE)
    private String updateUser;
}
